<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>维修工单视图</title>
<!-- 引入样式 -->
<link rel="stylesheet" href="https://unpkg.com/element-ui/lib/theme-chalk/index.css">
<script src="../js/axios.js"></script>
<script src="../js/qs.js"></script>
<script src="../js/jquery.min.js"></script>
<script src="../js/vue.js"></script>
<style type="text/css">
			#app {
				/* border:1px #dee1eb solid; */
			}

			#max {

				margin: 0 auto;
				margin-top: 40px;
				margin-bottom: 40px;
				width: 95%;
				background-color: white;
			}
			#max1 {
			
				margin: 0 auto;
				margin-bottom: 40px;
				width: 95%;
				
			}

			.table1 {
				margin: 0 auto;
				width: 80%;
			}

			.table1 tr {
				height: 40px;

			}

			.td1 {
				width: 10%;
				font-size: 12px;
				/* border-bottom:1px solid black; */
				/* border: 1px #e5e5e5 solid; */
				/* background-color: #F9F9F9; */
			}

			.td2 {
				font-size: 12px;
				text-align: left;
				width: 40%;
			}

			.el-table__header th,
			.el-table__header tr {
				background-color: #dee1e6;
				color: black;
				font-size: 12px;
				line-height: 20px;
			}
			#appreturnleft{
				background-color: white;
				 border:1px #dee1eb solid;
			}
			#appreturnright{
					background-color: white;
				 border:1px #dee1eb solid;
			}
		</style>
<!-- 引入组件库 -->
<script src="https://unpkg.com/element-ui/lib/index.js"></script>
</head>
<body style="background-color: rgb(244, 248, 251);">
	<div id="app" style="background-color: white; margin: 0 auto;width: 93%;margin-top:50px;border-radius: 10px;">
		<el-form :model="repform" :rules="reprules" ref="repform" label-width="100px" class="demo-repform" style="width: 90%;margin-top: 20px;margin-left:4%;">
			<br/>
			<p>
			<span style="font-size: 18px;font-weight:560;color: #807E7E;margin-top: 20px;">维修工单</span>
			<span style="float: right;">
				<!-- <el-button size="small" style="font-size: 14px;">查看关联采购单</el-button>
				<el-button v-if=" '接件'=='${repairOne.scheduleName}' " @click="updatehandleClick" size="small" icon="el-icon-delete" style="font-size: 14px;">&nbsp;编辑维修单</el-button>
				 -->
				 <el-button v-if=" '维修完成'=='${repairOne.scheduleName}' "  @click="deletenew" size="small" icon="el-icon-edit" style="font-size: 14px;">&nbsp;删除维修单</el-button>
					<!-- 删除遮罩层 -->
					<el-dialog title="提示" :visible.sync="dialogDelete" width="30%" append-to-body >
						<span>你确定要删除吗？</span>
							<span slot="footer" class="dialog-footer">
							<el-button @click="dialogDelete = false">取 消</el-button>
							<el-button type="primary" @click="dialogDelete = false" v-on:click="Delete" >确 定</el-button>
						</span>
					</el-dialog>
			</span>				
			</p>
			<hr style="border: 0.5px solid #666666;margin-top: 20px;margin-bottom: 25px;" />
			<p style="font-size: 15px;font-weight:550;color: #807E7E;margin-top: 20px;">单号与接收</p>
			<hr style="border: 0.5px solid #C0C0C0;margin-top: 10px;margin-bottom: 40px;" />
			<br/>
			<el-row >
				<el-col :span="10" style="margin-left:50px;" >
					<el-form-item label="接单人：" label-width="120px">
						<div style="border-bottom: 1px solid #DCDCDC;height: 35px;font-size: 15px;"> ${repairOne.userName}</div>
					</el-form-item>
				</el-col>
				<el-col :span="10" style="margin-left:40px;">
					<el-form-item label="对应客户：" label-width="120px">
						<div style="border-bottom: 1px solid #DCDCDC;height: 35px;font-size: 15px;"> ${repairOne.custName}</div>
					</el-form-item>
				</el-col>
			</el-row>
			<el-row >
				<el-col :span="10" style="margin-left:50px;">
					<el-form-item label="客户电话：" label-width="120px">
						<div style="border-bottom: 1px solid #DCDCDC;height: 35px;font-size: 15px;"> ${repairOne.custtel}</div>
					</el-form-item>
				</el-col>
				<el-col :span="10" style="margin-left:40px;">
					<el-form-item label="接件日期：" label-width="120px">
						<div style="border-bottom: 1px solid #DCDCDC;height: 35px;font-size: 15px;"> ${repairOne.getDate}</div>
					</el-form-item>
				</el-col>
			</el-row>

			<el-row>
				<el-col :span="10" style="margin-left:50px;">
					<el-form-item label="联系人：" label-width="120px">
						<div style="border-bottom: 1px solid #DCDCDC;height: 35px;font-size: 15px;"> ${repairOne.conName}</div>
					</el-form-item>
				</el-col>
				<el-col :span="10" style="margin-left:40px;">
					<el-form-item label="接件时间：" label-width="120px">
						<div style="border-bottom: 1px solid #DCDCDC;height: 35px;font-size: 15px;"> ${repairOne.getTime}</div>
					</el-form-item>
				</el-col>
			</el-row>
			<el-row>
				<el-col :span="10" style="margin-left:50px;">
					<el-form-item label="姓名：" label-width="120px">
						<div style="border-bottom: 1px solid #DCDCDC;height: 35px;font-size: 15px;"> ${repairOne.conName}</div>
					</el-form-item>
				</el-col>
				<el-col :span="10" style="margin-left:40px;">
					<el-form-item label="分类：" label-width="120px">
						<div style="border-bottom: 1px solid #DCDCDC;height: 35px;font-size: 15px;"> ${repairOne.classifyName}</div>
					</el-form-item>
				</el-col>
			</el-row>
			<el-row>
				<el-col :span="10" style="margin-left:50px;">
					<el-form-item label="联系人电话：" label-width="120px">
						<div style="border-bottom: 1px solid #DCDCDC;height: 35px;font-size: 15px;"> ${repairOne.contel}</div>
					</el-form-item>
				</el-col>
			</el-row>
			<hr style="border: 0.5px solid #C0C0C0;margin-top: 35px;" />
			<p style="font-size: 15px;font-weight:550;color: #333333;margin: 25px 0px 25px 0px;">接件详情</p>
			<hr style="border: 0.5px solid #C0C0C0;margin-bottom: 60px;" />
			<el-row >
				<el-col :span="10" style="margin-left:50px;">
					<el-form-item label="维修产品：" label-width="120px">
						<div style="border-bottom: 1px solid #DCDCDC;height: 35px;font-size: 15px;"> ${repairOne.goodName}</div>
					</el-form-item>
				</el-col>
				<el-col :span="10" style="margin-left:40px;">
					<el-form-item label="承接人：" label-width="120px">
						<div style="border-bottom: 1px solid #DCDCDC;height: 35px;font-size: 15px;"> ${repairOne.workerName}</div>
					</el-form-item>
				</el-col>
			</el-row>
			<el-row>
				<el-col :span="10" style="margin-left:50px;">
					<el-form-item label="产品销售日期：" label-width="120px">
						<div style="border-bottom: 1px solid #DCDCDC;height: 35px;font-size: 15px;"> ${repairOne.getDate}</div>
					</el-form-item>
				</el-col>
				<el-col :span="10" style="margin-left:40px;">
					<el-form-item label="故障描述：" label-width="120px">
						<div style="border-bottom: 1px solid #DCDCDC;height: 35px;font-size: 15px;"> ${repairOne.errorDescription}</div>
					</el-form-item>
				</el-col>
			</el-row>
			<el-row>
				<el-col :span="10" style="margin-left:50px;">
					<el-form-item label="维修工单进度：" label-width="120px">
						<div style="border-bottom: 1px solid #DCDCDC;height: 35px;font-size: 15px;"> ${repairOne.scheduleName}
						<a href="#" @click="centerDialogVisible = true" style="font-size: 12px;cursor: pointer;color: #999999;">说明</a>
							<el-dialog title="维修进度提示" :visible.sync="centerDialogVisible" width="30%" height="100px" append-to-body style="color: #EBEFF2;">
								<hr style="border: 0.5px solid #A8A297;margin-top: -30px;" />
								<p style="font-size: 14px;color: #000000;margin-bottom: 5px;">关于维修进度</p>
								<p style="font-size: 13px;color: #F43838;"> 接件→客户确认→开始维修→维修完成</p>
								<p slot="footer" class="dialog-footer">
									<el-button @click="centerDialogVisible = false" style="text-align: center;margin-top: -35px;">关 闭</el-button>
								</p>
							</el-dialog>
							</div>
					</el-form-item>
				</el-col>
				<el-col :span="10" style="margin-left:40px;">
					<el-form-item label="沟通/注意：" label-width="120px">
						<div style="border-bottom: 1px solid #DCDCDC;height: 35px;font-size: 15px;"> ${repairOne.communication}</div>
					</el-form-item>
				</el-col>
			</el-row>
			<el-row>
				<el-col :span="10" style="margin-left:50px;">
					<el-form-item label="保修：" label-width="120px">
						<div style="border-bottom: 1px solid #DCDCDC;height: 35px;font-size: 15px;"> ${repairOne.productName}</div>
					</el-form-item>
				</el-col>
			</el-row>

			<hr style="border: 0.5px solid #C0C0C0;margin-top: 35px;" />
			<p style="font-size: 15px;font-weight:550;color: #333333;margin: 25px 0px 25px 0px;">费用与执行</p>
			<hr style="border: 0.5px solid #C0C0C0;margin-top: 25px;margin-bottom: 60px;" />
			
			<el-row >
				<el-col :span="10" style="margin-left:50px;">
					<el-form-item label="费用：" label-width="120px">
						<div style="border-bottom: 1px solid #DCDCDC;height: 35px;font-size: 15px;"> ${repairOne.cost}</div>
					</el-form-item>
				</el-col>
				<el-col :span="10" style="margin-left:40px;">
					<el-form-item label="已收款：" label-width="120px">
						<div style="border-bottom: 1px solid #DCDCDC;height: 35px;font-size: 15px;"> ${repairOne.getCost}</div>
					</el-form-item>
				</el-col>
			</el-row>
			<el-row>
				<el-col :span="10" style="margin-left:50px;">
					<el-form-item label="状态：" label-width="120px">
						<div style="border-bottom: 1px solid #DCDCDC;height: 35px;font-size: 15px;"> ${repairOne.statusName}</div>
					</el-form-item>
				</el-col>
				<el-col :span="10" style="margin-left:40px;">
					<el-form-item label="约定交付日期：" label-width="120px">
						<div style="border-bottom: 1px solid #DCDCDC;height: 35px;font-size: 15px;"> ${repairOne.payDate}</div>
					</el-form-item>
				</el-col>
			</el-row>
			<el-row>
				<el-col :span="20" style="margin-left:50px;margin-bottom:80px;">
					<el-form-item label="备注：" label-width="120px">
						<div style="border-bottom: 1px solid #DCDCDC;height: 35px;font-size: 15px;"> ${repairOne.remark}</div>
					</el-form-item>
				</el-col>
			</el-row>
			<!-- <el-row style="float:right;margin-right:50px;margin-top:30px;">
				<el-col :span="24">
					<el-form-item>
						<el-button @click="returnForm()">返回</el-button>
						<el-button type="primary" @click="updateForm()">修改</el-button>
						<el-button @click="resetForm('repform')">重置</el-button>
					</el-form-item>
				</el-col>
			</el-row> -->
		</el-form>
	</div>
	<!-- <p>进入<a style="color:red;">客户确认→维修→交付<a/>完整过程</p> -->
	<!-- 维修步骤 -->
	<div id="app1" style="background-color: white; margin: 0 auto;width: 93%;margin-top:50px;border-radius: 10px;">
		<!-- 客户确认 -->
		<div id="gt">
		<el-form id="appgt" :model="repform" :rules="reprules" ref="repform" label-width="100px" class="demo-repform" style="width: 90%;margin-top: 20px;margin-left:4%;">
			<span style="font-size: 15px;line-height: 40px;margin-left: -10px;color: #000000;">维修步骤</span> 
			<p style="font-size: 14px;line-height: 20px;margin-left: -10px;">客服 <a style="color: #DD0000;">客户确认</a> 
				<el-button type="text" v-if=" '9'=='${user.uDept}' && '接件'=='${repairOne.scheduleName}' || '9'=='${user.uDept}' && '${repairrecordOne}'=='' " @click="closebj = true" style="float: right;margin-right: 50px;">编辑</el-button>
				<!--  && '${repairOne.workerName}'=='${user.uName}'  || repairrecordOne.length==0 -->
				<!-- 编辑客户确认信息 -->
				<el-dialog title="客户确认编辑" :visible.sync="closebj">
					<el-form :model="form" :rules="reprules" ref="repform">
						<el-form-item label="沟通要点" :label-width="formLabelWidth">
							<el-input type="textarea" clearable autosize placeholder="请输入内容" v-model="form.name"></el-input>
						</el-form-item>
						<el-form-item label="日期" :label-width="formLabelWidth">
							<el-date-picker v-model="form.date" value-format="yyyy-MM-dd" type="date" placeholder="选择日期"></el-date-picker>
						</el-form>
						<el-form-item label="时间" :label-width="formLabelWidth">
							<el-time-picker v-model="form.time" value-format="HH:mm:dd" :picker-options="{ selectableRange: '18:30:00 - 20:30:00' }" placeholder="任意时间点"></el-time-picker>
						</el-form-item>
						<el-button style="display: none;" v-model="form.id"></el-button>
						<el-button style="display: none;" v-model="form.man"></el-button>
						<el-button style="display: none;" v-model="form.statu"></el-button>
					</el-form>
					<el-button @click="submitForm('form')"  style="margin-left: 45%;margin-top: 15px;"type="primary" plain>保 存</el-button>
				</el-dialog>
			</p>
			<el-row>
				<el-col :span="10" style="margin-left:40px;">
					<el-form-item label="沟通/注意：" label-width="120px">
						<div style="border-bottom: 1px solid #DCDCDC;height: 35px;font-size: 15px;"> ${repairrecordOne.rcRemark} {{theme}}</div>
					</el-form-item>
				</el-col>
			</el-row>
			<el-row >
				<el-col :span="10" style="margin-left:40px;" >
					<el-form-item label="确认结果：" label-width="120px">
						<div style="border-bottom: 1px solid #DCDCDC;height: 35px;font-size: 15px;"> ${repairrecordOne.resultok} {{newresult}}</div>
					</el-form-item>
				</el-col>
				<el-col :span="10" style="margin-left:50px;">
					<el-form-item label="确认人员：" label-width="120px">
						<div style="border-bottom: 1px solid #DCDCDC;height: 35px;font-size: 15px;"> ${repairrecordOne.manok} {{newman}}</div>
					</el-form-item>
				</el-col>
			</el-row>
			<el-row >
				<el-col :span="10" style="margin-left:40px;">
					<el-form-item label="确认日期：" label-width="120px">
						<div style="border-bottom: 1px solid #DCDCDC;height: 35px;font-size: 15px;"> ${repairrecordOne.rcDateok} {{newdate}}</div>
					</el-form-item>
				</el-col>
				<el-col :span="10" style="margin-left:50px;">
					<el-form-item label="确认时间：" label-width="120px">
						<div style="border-bottom: 1px solid #DCDCDC;height: 35px;font-size: 15px;"> ${repairrecordOne.rcDateok} {{newtime}}</div>
					</el-form-item>
				</el-col>
			</el-row>
		</el-form>
			<el-button id="qrnext" v-if=" '9'=='${user.uDept}' && '接件'=='${repairOne.scheduleName}'" :disabled="isDisable" size="mini" round @click="custOK(form)" style="margin-left: 45%;margin-top: 15px;border: 1px solid wheat;">
				客户确认，进入下一步
			</el-button>
		</div>
		<!-- 维修过程 -->
		<!-- v-if=" '8'=='${user.uDept}' && '客户确认'=='${repairOne.scheduleName}' || '维修完成'=='${repairOne.scheduleName}'" -->
		<div id="wx">
			<el-form id="appwx" :model="repform" ref="repform" label-width="100px" class="demo-repform" style="width: 90%;margin-top: 20px;margin-left:4%;">
				<p style="font-size: 14px;line-height: 20px;margin-left: -10px;">维修人员 <a style="color: #DD0000;">维修过程</a> 
					<el-button type="text" v-if=" '8'=='${user.uDept}' &&  '${repairOne.workerName}'=='${user.uName}' || '8'=='${user.uDept}' && '维修完成'!='${repairOne.scheduleName}'" @click="dialogFormVisible = true" style="float: right;margin-right: 50px;">编辑</el-button>
					<!-- 编辑客户确认信息 -->
					<el-dialog title="维修编辑" :visible.sync="dialogFormVisible">
						<el-form :model="form">
							<el-form-item label="维修备注" :label-width="formLabelWidth">
								<el-input type="textarea" clearable autosize placeholder="请输入内容" v-model="form.remark"></el-input>
							</el-form-item>
							<!-- <el-form-item label="维修人员" :label-width="formLabelWidth">
								<el-input placeholder="请输入内容" v-model="form.repairman"></el-input>
							</el-form-item> -->
							<el-form-item label="维修开始时间" :label-width="formLabelWidth">
								<el-date-picker v-model="form.starttime" type="datetime" format="yyyy-MM-dd HH:mm:ss" placeholder="选择日期时间" value-format="yyyy-MM-dd HH:mm:ss" align="right" :picker-options="pickerOptions1"></el-date-picker>
							</el-form-item>
							<el-form-item label="维修完成时间" :label-width="formLabelWidth">
								<el-date-picker v-model="form.endtime" type="datetime" placeholder="选择日期时间" format="yyyy-MM-dd HH:mm:ss" value-format="yyyy-MM-dd HH:mm:ss" align="right" :picker-options="pickerOptions"></el-date-picker>
							</el-form-item>
							<el-button style="display: none;" v-model="form.id"></el-button>
							<el-button style="display: none;" v-model="form.man"></el-button>
							<el-button style="display: none;" v-model="form.statu"></el-button>
						</el-form>
						<el-button @click="submitForm('form')"  style="margin-left: 45%;margin-top: 15px;"type="primary" plain>保 存</el-button>
					</el-dialog>
				</p>
				<el-row>
					<el-col :span="10" style="margin-left:40px;">
						<el-form-item label="维修备注：" label-width="120px">
							<div style="border-bottom: 1px solid #DCDCDC;height: 35px;font-size: 15px;">${repairrecordOne.pRemark} {{theme}}</div>
						</el-form-item>
					</el-col>
				</el-row>
				<el-row >
					<el-col :span="10" style="margin-left:40px;" >
						<el-form-item label="维修开始时间：" label-width="120px">
							<div style="border-bottom: 1px solid #DCDCDC;height: 35px;font-size: 15px;"> ${repairrecordOne.pStarttime} {{newstart}}</div>
						</el-form-item>
					</el-col>
					<el-col :span="10" style="margin-left:50px;">
						<el-form-item label="维修结束时间：" label-width="120px">
							<div style="border-bottom: 1px solid #DCDCDC;height: 35px;font-size: 15px;"> ${repairrecordOne.pEndtime} {{newend}}</div>
						</el-form-item>
					</el-col>
				</el-row>
				<el-row >
					<el-col :span="10" style="margin-left:40px;">
						<el-form-item label="维修人员：" label-width="120px">
							<div style="border-bottom: 1px solid #DCDCDC;height: 35px;font-size: 15px;"> ${repairrecordOne.repairman} {{newman}}</div>
						</el-form-item>
					</el-col>
					<el-col :span="10" style="margin-left:50px;">
						<el-form-item label="当前状态：" label-width="120px">
							<div style="border-bottom: 1px solid #DCDCDC;height: 35px;font-size: 15px;"> ${repairrecordOne.paystatue} {{newresult}}</div>
						</el-form-item>
					</el-col>
				</el-row>
			</el-form>
			<el-button size="mini" v-if=" '8'=='${user.uDept}' && '客户确认'=='${repairOne.scheduleName}'" @click="custOK(form)" :disabled="isDisable" round style="margin-left: 45%;margin-top: 15px;border: 1px solid wheat;">
				维修完成,提交信息
			</el-button>
		</div>
	</div>
	<!-- 维修配件收费表 -->
	<div id="app2" style="background-color: white; margin: 0 auto;width: 93%;margin-top:50px;border-radius: 10px;">
		<br />
		<span style="margin-left: 35px;line-height: 20px;font-size: 15px;color: #000000;">$ 费用&维修配件服务明细</span>
		<!-- <p style="margin-left: 35px;font-size: 14px;color: #666666;">收费/回款记录</p> -->
		<hr style="border: 0.5px solid #D2DCF8;width: 95%;">
		<!-- <p style="margin-left: 35px;font-size: 14px;color: #666666;">开票记录</p>
		<hr style="border: 0.5px solid #D2DCF8;width: 95%;"> -->
		<tr align="center">
			<td class="td1" colspan="4">
				<div id="spendiv" style="width: 90%; text-align: right;">
					<div style="margin-right: 2%;">
						<span  style=" float: left;margin-left: 35px;font-size: 14px;color: #666666;">维修配件及服务明细</span >
						<a style="color: #0080FF;float: right;margin-right: -50px;font-size: 14px; cursor:pointer;" v-if=" '8'=='${user.uDept}' &&  '${repairOne.workerName}'=='${user.uName}' && '维修完成'!='${repairOne.scheduleName}' " @click="showorderitem">编辑明细</a></div>
					</div>
				<div>
					<template>
						<br />
						<el-table :data="tableData" border :summary-method="getSummaries" style="width: 95%;margin: 0 auto;border-radius: 5px;margin-top: 10px;" show-summary>
							<el-table-column prop="p_name" label="产品名" align="center">
							</el-table-column>
							<el-table-column prop="count" label="数量" align="center">
							</el-table-column>
							<!-- <el-table-column prop="technology" label="单位" align="center">
							</el-table-column>
							<el-table-column prop="p_unit" label="厂商承担" align="center">
							</el-table-column> -->
							<el-table-column prop="price" label="单价" align="center">
							</el-table-column>
							<el-table-column prop="discount" label="折扣" align="center">
							</el-table-column>
							<el-table-column prop="money" label="金额" align="center">
							</el-table-column>
							<el-table-column prop="remark" show-overflow-tooltip label="备注" align="center">
							</el-table-column>
						</el-table>
						<br />
					</template>
			</td>
		</tr>
	</div>	
	</div>
	<script type="text/javascript">
		var userdept=${user.uDept};
		var rid=${repairOne.ID};
		var repairProductItem=${repairProductItem};
		console.log(repairProductItem);
	</script>
	<script type="text/javascript">
		var Main = {
			data() {
				return {
					repform: {
						getPerson: '',
						custID: '',
						repID: '',
						repphone: '',
						repname: '',
						gdchlassity: '',
						reptel: '',
						proID: '',
						getman: '',
						texterrorDescription:'',
						textcommunication:'',
						radioguarantee:'',
						alljindu:'',
						rocost:'',
						hasgetcost:'',
						radiosatus:'',
						roprofit:'',
						textcommunication:''
					},
					reprules: {},
					gettoday:'',
					gettime: '',
					prostarttoday: '',
					prosalettoday: '',
					paytoday:'',
					centerDialogVisible:false,
					dialogDelete: false
			};
			},
			methods:{
			
				//删除方法
				deletenew(){
					this.ID=${repairOne.ID};
					this.dialogDelete=true;
				},
				Delete(){
					var _this=this;
					axios.get("/aftersale/deleteOneRepair",
							{
								params:{
								ID:_this.ID
								}
							}).then(function(response){					          				
								console.log("回调成功，获取了服务器端返回的值v");
								console.log(response.data);					           		
								_this.restaurants=response.data;
								console.log(response.data.RoStatus);
								console.log(response.data.RoSchedule);
								/*  && response.data.RoStatus!=1265 */
								if (response.data.RoSchedule!=1436) {
									_this.$message({
											showClose: true,
								type: 'error',
								message: '工单未结束!删除失败!',
								duration:3000,
								center: true
						});
						} else {
							//alert("删除成功！");
								_this.$message({
								showClose: true,
								type: 'success',
								message: '删除成功!',
								duration:3000,
								center: true
							});
								//延时两秒刷新
								setTimeout(function (){
									window.location.href='/index#/aftersale/repair';
								}, 2000);
							}
							}).catch(function(){
								//alert("删除失败！");
								_this.$message({
								type: 'error',
								message: '删除失败!',
								duration:3000,
								center: true
							});
						});	//这个是数据的初始化
				}
			},
			};
		var Ctor = Vue.extend(Main)
		new Ctor().$mount('#app')
		
		//获取系统时间
		function getNowFormatDate() {//获取当前时间
			var date = new Date();
			var seperator1 = "-";
			var month = date.getMonth() + 1<10? "0"+(date.getMonth() + 1):date.getMonth() + 1;
			var strDate = date.getDate()<10? "0" + date.getDate():date.getDate();
			var currentdate = date.getFullYear() + seperator1  + month  + seperator1  + strDate;
			return currentdate;
		}
		//获取年月日时分秒
		var d = new Date();
		var str = d.getFullYear()+"-"+((d.getMonth()+1)>=10?+(d.getMonth()+1):"0"+(d.getMonth()+1))+"-"+((d.getDate())>=10?d.getDate():'0'+d.getDate());
		/* 沟通 */
		var Main = {
			data() {
				return {
					repform: {
					},
					reprules: {
					},
					isDisable: false,
					closebj: false,
					form: {
					  name: '',
					  date: getNowFormatDate(),
					  time: new Date().toLocaleTimeString('chinese', { hour12: false }),
					  statu:1433,
					  man:${user.uId},
					  id:${repairOne.ID},
					},
					theme:'',
					newdate:'',
					newtime:'',
					newresult:'',
					newman:'', 
					formLabelWidth: '120px'
				};
			},
			methods:{
				submitForm(form){
					console.log("获取沟通信息记录：");
					console.log(this.form);
						this.theme=this.form.name;
						this.newdate=this.form.date;
						this.newtime=this.form.time;
						this.newresult="已确认";
						this.newman="${user.uName}";
						//添加维修跟踪记录
						//post提交数据
						axios.post("/aftersale/addrepairrecord",
							//参数转换
							Qs.stringify(this.form, {
								arrayFormat: 'brackets'
							})
						),
						this.closebj=false;
					},
					custOK(form){
						this.submitForm(form);
						//修改工单状态
						axios.post("/aftersale/updateSchedule",
							Qs.stringify({
								ID: ${repairOne.ID},
								newresult: '1433',
								textcommunication:this.theme,
							}, {
								arrayFormat: 'brackets'
							})
						),
						//刷新页面
						window.location.href=window.location.href;
						this.isDisable = true;
						//禁用button按钮
						//document.getElementById("qrnext").style.disabled=true;
					}
				},
				mounted:function(){
					var _this = this;
					//查询新增的客户确认信息
					axios.post("/aftersale/repairrecordOne",
							Qs.stringify({
								'ID': ${repairOne.ID}
							}, {
								arrayFormat: 'brackets'
							})
						).then(function(v){
							console.log("回调："+JSON.stringify(v.data.repairrecordOne));
							var time=v.data.repairrecordOne.rcDateok;
							//时间格式转化
							var d = new Date(time);
							var times=d.getFullYear() + '-' + (d.getMonth() + 1) + '-' + d.getDate();
							_this.theme=v.data.repairrecordOne.rcRemark;
							_this.newdate=v.data.repairrecordOne.rcDateok;
							_this.newtime=v.data.repairrecordOne.rcTimeok;
							_this.newresult=v.data.repairrecordOne.resultok;
							_this.newman=v.data.repairrecordOne.manok;
						})
				}
			};
			var Ctor = Vue.extend(Main)
			new Ctor().$mount('#gt')
		/* 维修 */
		var Main = {
			data() {
				return {
					repform: {
					},
					reprules: {
					},
					isDisable: false,
					dialogFormVisible: false,
					form: {
						remark: '',
						repairman:'',
						starttime:'',
						endtime:'',
						statu:'',
						man:${user.uId},
						id:${repairOne.ID},
					},
						theme:'',
						newstart:'',
						newend:'',
						newresult:'',
						newman:'', 
					formLabelWidth: '120px', 
					pickerOptions1: {
						disabledDate(starttime) {
							return starttime.getTime() > Date.now();
						},
					  shortcuts: [{
						text: '今天',
						onClick(picker) {
						  picker.$emit('pick', new Date());
						}
					  }, {
						text: '昨天',
						onClick(picker) {
						  const date = new Date();
						  date.setTime(date.getTime() - 3600 * 1000 * 24);
						  picker.$emit('pick', date);
						}
					  }, {
						text: '一周前',
						onClick(picker) {
						  const date = new Date();
						  date.setTime(date.getTime() - 3600 * 1000 * 24 * 7);
						  picker.$emit('pick', date);
						}
					  }]
					},
					pickerOptions: {
						disabledDate(endtime) {
							return endtime.getTime() < Date.now();
						},
						shortcuts: [{
						text: '今天',
						onClick(picker) {
							picker.$emit('pick', new Date());
						}
						}, {
						text: '明天',
						onClick(picker) {
							const date = new Date();
							date.setTime(date.getTime() + 3600 * 1000 * 24);
							picker.$emit('pick', date);
						}
						}, {
						text: '一周后',
						onClick(picker) {
							const date = new Date();
							date.setTime(date.getTime() + 3600 * 1000 * 24 * 7);
							picker.$emit('pick', date);
						}
						}]
					},
				};
			},
			methods:{
				submitForm(form){
					console.log("获取维修信息记录：");
					console.log(this.form);
						this.theme=this.form.remark;
						this.newstart=this.form.starttime;
						this.newend=this.form.endtime;
						this.newresult="维修完成";
						this.newman="${user.uName}";
						//添加维修跟踪记录
						//post提交数据
						console.log("维修更新状态:"+JSON.stringify(this.form));
						 axios.post("/aftersale/updaterepairrecordOne",
							//参数转换
							Qs.stringify(this.form, {
								arrayFormat: 'brackets'
							})
						),
						this.dialogFormVisible=false;
					},
					custOK(form){
						this.submitForm(form);
						//修改工单状态
						axios.post("/aftersale/updateSchedule",
							Qs.stringify({
								ID: ${repairOne.ID},
								newresult: '1436',
								textcommunication:this.theme,
							}, {
								arrayFormat: 'brackets'
							})
						), 
						
						//禁用button按钮
						this.isDisable = true;
						//document.getElementById("wxnext").style.disabled=true;
						this.$notify({
							title: '提示',
							message: '维修工单处理完成！',
							type: 'success',
							offset: 1000
						});
						//刷新页面
						window.location.href=window.location.href;
					}
			},
			mounted:function(){
					var _this = this;
					//查询新增的维修信息
					axios.post("/aftersale/repairrecordOne",
							Qs.stringify({
								'ID': ${repairOne.ID}
							}, {
								arrayFormat: 'brackets'
							})
						).then(function(v){
							console.log("回调："+JSON.stringify(v.data.repairrecordOne));
							var repairrecordnew=JSON.stringify(v.data.repairrecordOne);
							//console.log(repairrecordnew);
							//时间格式转化
							_this.theme=v.data.repairrecordOne.pRemark;
							_this.newstart=v.data.repairrecordOne.pStarttime;
							_this.newend=v.data.repairrecordOne.pEndtime;
							_this.newresult=v.data.repairrecordOne.resultok;
							_this.newman=v.data.repairrecordOne.repairman;
						})
				}
		};
		var Ctor = Vue.extend(Main)
		new Ctor().$mount('#wx')
		
		new Vue({
			el:"#app2",
			data:{
				tableData:repairProductItem,
			},
			methods:{
				showorderitem() {
					//跳转添加配件页面
					window.location.href = '/aftersale/repairProductItem?id=' + rid;
				},
				getSummaries(param) {
						const {columns,data} = param;
						const sums = [];
						columns.forEach((column, index) => {
							if (index === 0) {
								sums[index] = '总计';
								return;
							}
							const values = data.map(item => Number(item[column.property]));

							if (!values.every(value => isNaN(value))) {
								sums[index] = values.reduce((prev, curr) => {
									const value = Number(index);

									if (!isNaN(value) && index != 3) {
										return prev + curr;
									} else {
										return '';
									}

								}, 0);
								if (index == 4 || index == 6) {
									sums[index] = sums[index].toFixed(2);
								}
								if (index == 1 || index == 3 || index == 4 || index == 5 || index == 7)
									sums[index] = '---';
								if (index == 6)
									sums[index] += ' 元';
							} else {
								sums[index] = '';
							}
						});
						return sums;
					},
			}
		})
	</script>
</body>
</html>